<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 400px;
            height: 600px;
            background-color: pink;
            margin: 100px auto;
            color: #33e5aa;
            text-align: center;
            font-size: 60px;
        }
    </style>
</head>

<body>
    <div>0</div>
    <script>
        const box = document.querySelector('div')
        let timer
        function debounce(fn, t) {
            return function () {
                if (timer) clearTimeout(timer)
                timer = setTimeout(function () {
                    fn()
                }, t)
            }

        } 
        let i = 1
        function num() {
            box.innerHTML = i++
        }
        box.addEventListener('mousemove', debounce(num, 500))

    </script>
</body>

</html>